package com.tlvip.arithmetic.ch02;

import org.apache.commons.lang3.RandomUtils;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

/**
 * <p>description：制造年龄数据的工具类</p>
 * <p>copyright： copyright(C)2016-2099</p>
 * <p>Life is short,we need passion</p>
 * <p>Summary： </p>
 * <p>instructions： </p>
 * Date 1/23/21</p>
 * Author mac
 *
 * @version 1.0
 */
public class MakeDBFile {
    public static void main(String[] args) {
        BufferedWriter out = null;
        try {
            int total = 1400000000;
            Random random = new Random();
            out = new BufferedWriter(new FileWriter("/Users/zhaobing/temp/ageFile.txt"));
            for (int i = 0; i < total; i++) {
                int age = random.nextInt(130);
                out.write(String.valueOf(age));
                out.newLine();
            }

            System.out.println("文件创建成功！");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    }
}
